<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>m4.include/ax_gcc_func_attribute.m4</title>
<meta name='robots' content='noindex,nofollow' />
<meta name='generator' content='GLOBAL-6.5.7' />
<meta http-equiv='Content-Style-Type' content='text/css' />
<link rel='stylesheet' type='text/css' href='../style.css' />
</head>
<body>
<!-- beginning of fixed guide -->
<div id='guide'><ul>
<li><a href='#TOP'><img class='icon' src='../icons/first.png' alt='[^]' /></a></li>
<li><a href='#BOTTOM'><img class='icon' src='../icons/last.png' alt='[v]' /></a></li>
<li><a href='#TOP'><img class='icon' src='../icons/top.png' alt='[top]' /></a></li>
<li><a href='#BOTTOM'><img class='icon' src='../icons/bottom.png' alt='[bottom]' /></a></li>
<li><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a></li>
<li><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a></li>
<li class='standout'><span><a href='../files/m4.include.html'>m4.include</a>/ax_gcc_func_attribute.m4</span></li>
</ul></div>
<!-- end of fixed guide -->
<a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/m4.include.html'>m4.include</a>/ax_gcc_func_attribute.m4</h2>
<em class='comment'>/* <img class='icon' src='../icons/n_left.png' alt='[previous]' /><img class='icon' src='../icons/n_right.png' alt='[next]' /><img class='icon' src='../icons/n_first.png' alt='[first]' /><img class='icon' src='../icons/n_last.png' alt='[last]' /><img class='icon' src='../icons/n_top.png' alt='[top]' /><a href='#BOTTOM'><img class='icon' src='../icons/bottom.png' alt='[bottom]' /></a><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a>&nbsp;<input type='text' readonly onfocus='this.select();' value='+1 m4.include/ax_gcc_func_attribute.m4'  /> */</em>
<hr />
<pre>
<a id='L1' name='L1'></a># ===========================================================================
<a id='L2' name='L2'></a>#  https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html
<a id='L3' name='L3'></a># ===========================================================================
<a id='L4' name='L4'></a>#
<a id='L5' name='L5'></a># SYNOPSIS
<a id='L6' name='L6'></a>#
<a id='L7' name='L7'></a>#   AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE)
<a id='L8' name='L8'></a>#
<a id='L9' name='L9'></a># DESCRIPTION
<a id='L10' name='L10'></a>#
<a id='L11' name='L11'></a>#   This macro checks if the compiler supports one of GCC's function
<a id='L12' name='L12'></a>#   attributes; many other compilers also provide function attributes with
<a id='L13' name='L13'></a>#   the same syntax. Compiler warnings are used to detect supported
<a id='L14' name='L14'></a>#   attributes as unsupported ones are ignored by default so quieting
<a id='L15' name='L15'></a>#   warnings when using this macro will yield false positives.
<a id='L16' name='L16'></a>#
<a id='L17' name='L17'></a>#   The ATTRIBUTE parameter holds the name of the attribute to be checked.
<a id='L18' name='L18'></a>#
<a id='L19' name='L19'></a>#   If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_&lt;ATTRIBUTE&gt;.
<a id='L20' name='L20'></a>#
<a id='L21' name='L21'></a>#   The macro caches its result in the ax_cv_have_func_attribute_&lt;attribute&gt;
<a id='L22' name='L22'></a>#   variable.
<a id='L23' name='L23'></a>#
<a id='L24' name='L24'></a>#   The macro currently supports the following function attributes:
<a id='L25' name='L25'></a>#
<a id='L26' name='L26'></a>#    alias
<a id='L27' name='L27'></a>#    aligned
<a id='L28' name='L28'></a>#    alloc_size
<a id='L29' name='L29'></a>#    always_inline
<a id='L30' name='L30'></a>#    artificial
<a id='L31' name='L31'></a>#    cold
<a id='L32' name='L32'></a>#    const
<a id='L33' name='L33'></a>#    constructor
<a id='L34' name='L34'></a>#    constructor_priority for constructor attribute with priority
<a id='L35' name='L35'></a>#    deprecated
<a id='L36' name='L36'></a>#    destructor
<a id='L37' name='L37'></a>#    dllexport
<a id='L38' name='L38'></a>#    dllimport
<a id='L39' name='L39'></a>#    error
<a id='L40' name='L40'></a>#    externally_visible
<a id='L41' name='L41'></a>#    fallthrough
<a id='L42' name='L42'></a>#    flatten
<a id='L43' name='L43'></a>#    format
<a id='L44' name='L44'></a>#    format_arg
<a id='L45' name='L45'></a>#    gnu_inline
<a id='L46' name='L46'></a>#    hot
<a id='L47' name='L47'></a>#    ifunc
<a id='L48' name='L48'></a>#    leaf
<a id='L49' name='L49'></a>#    malloc
<a id='L50' name='L50'></a>#    noclone
<a id='L51' name='L51'></a>#    noinline
<a id='L52' name='L52'></a>#    nonnull
<a id='L53' name='L53'></a>#    noreturn
<a id='L54' name='L54'></a>#    nothrow
<a id='L55' name='L55'></a>#    optimize
<a id='L56' name='L56'></a>#    pure
<a id='L57' name='L57'></a>#    sentinel
<a id='L58' name='L58'></a>#    sentinel_position
<a id='L59' name='L59'></a>#    unused
<a id='L60' name='L60'></a>#    used
<a id='L61' name='L61'></a>#    visibility
<a id='L62' name='L62'></a>#    warning
<a id='L63' name='L63'></a>#    warn_unused_result
<a id='L64' name='L64'></a>#    weak
<a id='L65' name='L65'></a>#    weakref
<a id='L66' name='L66'></a>#
<a id='L67' name='L67'></a>#   Unsupported function attributes will be tested with a prototype
<a id='L68' name='L68'></a>#   returning an int and not accepting any arguments and the result of the
<a id='L69' name='L69'></a>#   check might be wrong or meaningless so use with care.
<a id='L70' name='L70'></a>#
<a id='L71' name='L71'></a># LICENSE
<a id='L72' name='L72'></a>#
<a id='L73' name='L73'></a>#   Copyright (c) 2013 Gabriele Svelto &lt;gabriele.svelto@gmail.com&gt;
<a id='L74' name='L74'></a>#
<a id='L75' name='L75'></a>#   Copying and distribution of this file, with or without modification, are
<a id='L76' name='L76'></a>#   permitted in any medium without royalty provided the copyright notice
<a id='L77' name='L77'></a>#   and this notice are preserved.  This file is offered as-is, without any
<a id='L78' name='L78'></a>#   warranty.
<a id='L79' name='L79'></a> 
<a id='L80' name='L80'></a>#serial 9
<a id='L81' name='L81'></a> 
<a id='L82' name='L82'></a>AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [
<a id='L83' name='L83'></a>    AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1])
<a id='L84' name='L84'></a> 
<a id='L85' name='L85'></a>    AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [
<a id='L86' name='L86'></a>        AC_LINK_IFELSE([AC_LANG_PROGRAM([
<a id='L87' name='L87'></a>            m4_case([$1],
<a id='L88' name='L88'></a>                [alias], [
<a id='L89' name='L89'></a>                    int foo( void ) { return 0; }
<a id='L90' name='L90'></a>                    int bar( void ) __attribute__(($1("foo")));
<a id='L91' name='L91'></a>                ],
<a id='L92' name='L92'></a>                [aligned], [
<a id='L93' name='L93'></a>                    int foo( void ) __attribute__(($1(32)));
<a id='L94' name='L94'></a>                ],
<a id='L95' name='L95'></a>                [alloc_size], [
<a id='L96' name='L96'></a>                    void *foo(int a) __attribute__(($1(1)));
<a id='L97' name='L97'></a>                ],
<a id='L98' name='L98'></a>                [always_inline], [
<a id='L99' name='L99'></a>                    inline __attribute__(($1)) int foo( void ) { return 0; }
<a id='L100' name='L100'></a>                ],
<a id='L101' name='L101'></a>                [artificial], [
<a id='L102' name='L102'></a>                    inline __attribute__(($1)) int foo( void ) { return 0; }
<a id='L103' name='L103'></a>                ],
<a id='L104' name='L104'></a>                [cold], [
<a id='L105' name='L105'></a>                    int foo( void ) __attribute__(($1));
<a id='L106' name='L106'></a>                ],
<a id='L107' name='L107'></a>                [const], [
<a id='L108' name='L108'></a>                    int foo( void ) __attribute__(($1));
<a id='L109' name='L109'></a>                ],
<a id='L110' name='L110'></a>                [constructor_priority], [
<a id='L111' name='L111'></a>                    int foo( void ) __attribute__((__constructor__(65535/2)));
<a id='L112' name='L112'></a>                ],
<a id='L113' name='L113'></a>                [constructor], [
<a id='L114' name='L114'></a>                    int foo( void ) __attribute__(($1));
<a id='L115' name='L115'></a>                ],
<a id='L116' name='L116'></a>                [deprecated], [
<a id='L117' name='L117'></a>                    int foo( void ) __attribute__(($1("")));
<a id='L118' name='L118'></a>                ],
<a id='L119' name='L119'></a>                [destructor], [
<a id='L120' name='L120'></a>                    int foo( void ) __attribute__(($1));
<a id='L121' name='L121'></a>                ],
<a id='L122' name='L122'></a>                [dllexport], [
<a id='L123' name='L123'></a>                    __attribute__(($1)) int foo( void ) { return 0; }
<a id='L124' name='L124'></a>                ],
<a id='L125' name='L125'></a>                [dllimport], [
<a id='L126' name='L126'></a>                    int foo( void ) __attribute__(($1));
<a id='L127' name='L127'></a>                ],
<a id='L128' name='L128'></a>                [error], [
<a id='L129' name='L129'></a>                    int foo( void ) __attribute__(($1("")));
<a id='L130' name='L130'></a>                ],
<a id='L131' name='L131'></a>                [externally_visible], [
<a id='L132' name='L132'></a>                    int foo( void ) __attribute__(($1));
<a id='L133' name='L133'></a>                ],
<a id='L134' name='L134'></a>                [fallthrough], [
<a id='L135' name='L135'></a>                    int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }};
<a id='L136' name='L136'></a>                ],
<a id='L137' name='L137'></a>                [flatten], [
<a id='L138' name='L138'></a>                    int foo( void ) __attribute__(($1));
<a id='L139' name='L139'></a>                ],
<a id='L140' name='L140'></a>                [format], [
<a id='L141' name='L141'></a>                    int foo(const char *p, ...) __attribute__(($1(printf, 1, 2)));
<a id='L142' name='L142'></a>                ],
<a id='L143' name='L143'></a>                [format_arg], [
<a id='L144' name='L144'></a>                    char *foo(const char *p) __attribute__(($1(1)));
<a id='L145' name='L145'></a>                ],
<a id='L146' name='L146'></a>                [gnu_inline], [
<a id='L147' name='L147'></a>                    inline __attribute__(($1)) int foo( void ) { return 0; }
<a id='L148' name='L148'></a>                ],
<a id='L149' name='L149'></a>                [hot], [
<a id='L150' name='L150'></a>                    int foo( void ) __attribute__(($1));
<a id='L151' name='L151'></a>                ],
<a id='L152' name='L152'></a>                [ifunc], [
<a id='L153' name='L153'></a>                    int my_foo( void ) { return 0; }
<a id='L154' name='L154'></a>                    static int (*resolve_foo(void))(void) { return my_foo; }
<a id='L155' name='L155'></a>                    int foo( void ) __attribute__(($1("resolve_foo")));
<a id='L156' name='L156'></a>                ],
<a id='L157' name='L157'></a>                [leaf], [
<a id='L158' name='L158'></a>                    __attribute__(($1)) int foo( void ) { return 0; }
<a id='L159' name='L159'></a>                ],
<a id='L160' name='L160'></a>                [malloc], [
<a id='L161' name='L161'></a>                    void *foo( void ) __attribute__(($1));
<a id='L162' name='L162'></a>                ],
<a id='L163' name='L163'></a>                [noclone], [
<a id='L164' name='L164'></a>                    int foo( void ) __attribute__(($1));
<a id='L165' name='L165'></a>                ],
<a id='L166' name='L166'></a>                [noinline], [
<a id='L167' name='L167'></a>                    __attribute__(($1)) int foo( void ) { return 0; }
<a id='L168' name='L168'></a>                ],
<a id='L169' name='L169'></a>                [nonnull], [
<a id='L170' name='L170'></a>                    int foo(char *p) __attribute__(($1(1)));
<a id='L171' name='L171'></a>                ],
<a id='L172' name='L172'></a>                [noreturn], [
<a id='L173' name='L173'></a>                    void foo( void ) __attribute__(($1));
<a id='L174' name='L174'></a>                ],
<a id='L175' name='L175'></a>                [nothrow], [
<a id='L176' name='L176'></a>                    int foo( void ) __attribute__(($1));
<a id='L177' name='L177'></a>                ],
<a id='L178' name='L178'></a>                [optimize], [
<a id='L179' name='L179'></a>                    __attribute__(($1(3))) int foo( void ) { return 0; }
<a id='L180' name='L180'></a>                ],
<a id='L181' name='L181'></a>                [pure], [
<a id='L182' name='L182'></a>                    int foo( void ) __attribute__(($1));
<a id='L183' name='L183'></a>                ],
<a id='L184' name='L184'></a>                [sentinel], [
<a id='L185' name='L185'></a>                    int foo(void *p, ...) __attribute__(($1));
<a id='L186' name='L186'></a>                ],
<a id='L187' name='L187'></a>                [sentinel_position], [
<a id='L188' name='L188'></a>                    int foo(void *p, ...) __attribute__(($1(1)));
<a id='L189' name='L189'></a>                ],
<a id='L190' name='L190'></a>                [returns_nonnull], [
<a id='L191' name='L191'></a>                    void *foo( void ) __attribute__(($1));
<a id='L192' name='L192'></a>                ],
<a id='L193' name='L193'></a>                [unused], [
<a id='L194' name='L194'></a>                    int foo( void ) __attribute__(($1));
<a id='L195' name='L195'></a>                ],
<a id='L196' name='L196'></a>                [used], [
<a id='L197' name='L197'></a>                    int foo( void ) __attribute__(($1));
<a id='L198' name='L198'></a>                ],
<a id='L199' name='L199'></a>                [visibility], [
<a id='L200' name='L200'></a>                    int foo_def( void ) __attribute__(($1("default")));
<a id='L201' name='L201'></a>                    int foo_hid( void ) __attribute__(($1("hidden")));
<a id='L202' name='L202'></a>                    int foo_int( void ) __attribute__(($1("internal")));
<a id='L203' name='L203'></a>                    int foo_pro( void ) __attribute__(($1("protected")));
<a id='L204' name='L204'></a>                ],
<a id='L205' name='L205'></a>                [warning], [
<a id='L206' name='L206'></a>                    int foo( void ) __attribute__(($1("")));
<a id='L207' name='L207'></a>                ],
<a id='L208' name='L208'></a>                [warn_unused_result], [
<a id='L209' name='L209'></a>                    int foo( void ) __attribute__(($1));
<a id='L210' name='L210'></a>                ],
<a id='L211' name='L211'></a>                [weak], [
<a id='L212' name='L212'></a>                    int foo( void ) __attribute__(($1));
<a id='L213' name='L213'></a>                ],
<a id='L214' name='L214'></a>                [weakref], [
<a id='L215' name='L215'></a>                    static int foo( void ) { return 0; }
<a id='L216' name='L216'></a>                    static int bar( void ) __attribute__(($1("foo")));
<a id='L217' name='L217'></a>                ],
<a id='L218' name='L218'></a>                [
<a id='L219' name='L219'></a>                 m4_warn([syntax], [Unsupported attribute $1, the test may fail])
<a id='L220' name='L220'></a>                 int foo( void ) __attribute__(($1));
<a id='L221' name='L221'></a>                ]
<a id='L222' name='L222'></a>            )], [])
<a id='L223' name='L223'></a>            ],
<a id='L224' name='L224'></a>            dnl GCC doesn't exit with an error if an unknown attribute is
<a id='L225' name='L225'></a>            dnl provided but only outputs a warning, so accept the attribute
<a id='L226' name='L226'></a>            dnl only if no warning were issued.
<a id='L227' name='L227'></a>            [AS_IF([test -s conftest.err],
<a id='L228' name='L228'></a>                [AS_VAR_SET([ac_var], [no])],
<a id='L229' name='L229'></a>                [AS_VAR_SET([ac_var], [yes])])],
<a id='L230' name='L230'></a>            [AS_VAR_SET([ac_var], [no])])
<a id='L231' name='L231'></a>    ])
<a id='L232' name='L232'></a> 
<a id='L233' name='L233'></a>    AS_IF([test yes = AS_VAR_GET([ac_var])],
<a id='L234' name='L234'></a>        [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1,
<a id='L235' name='L235'></a>            [Define to 1 if the system has the `$1' function attribute])], [])
<a id='L236' name='L236'></a> 
<a id='L237' name='L237'></a>    AS_VAR_POPDEF([ac_var])
<a id='L238' name='L238'></a>])
</pre>
<hr />
<a id='BOTTOM' name='BOTTOM'></a>
<em class='comment'>/* <img class='icon' src='../icons/n_left.png' alt='[previous]' /><img class='icon' src='../icons/n_right.png' alt='[next]' /><img class='icon' src='../icons/n_first.png' alt='[first]' /><img class='icon' src='../icons/n_last.png' alt='[last]' /><a href='#TOP'><img class='icon' src='../icons/top.png' alt='[top]' /></a><img class='icon' src='../icons/n_bottom.png' alt='[bottom]' /><a href='../mains.html'><img class='icon' src='../icons/index.png' alt='[index]' /></a><a href='../help.html'><img class='icon' src='../icons/help.png' alt='[help]' /></a>&nbsp;<input type='text' readonly onfocus='this.select();' value='+238 m4.include/ax_gcc_func_attribute.m4'  /> */</em>
</body>
</html>
